package com.project.interceptor;

import com.project.bean.UserBean;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TeacherInterceptor implements HandlerInterceptor {

     @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

         UserBean user = (UserBean) request.getSession().getAttribute("loginUser");
         if (user.getLevel().equals("房间管理员")||user.getLevel().equals("系统管理员")) {
             response.sendRedirect("/homehtml/homePage.html");
             return false;
         } else {
             return true;
         }


    }
}
